#!/usr/bin/env python

import imp
import os
import subprocess

python_dir  = 'python'
kt_dir      = os.path.join(python_dir, 'kt')
config_file = os.path.join(kt_dir, 'config.py')
config      = imp.load_source('config', config_file)

os.environ['CFLAGS'] = config.CFLAGS

configure_command = [
    '/bin/sh',
    'configure',
    '--disable-freetype',
    '--without-freetype-src',
    '--without-freetype-bytecode',
    '--disable-shared',
    '--enable-static',
    '--enable-pyextension',
    '--disable-type3',
    '--without-regular-link',
    '--with-pic',
    '--without-x',
    '--without-cairo',
    '--without-pango',
    '--without-native-script',
    '--disable-double',
    '--with-python=python3',
    ]

p = subprocess.Popen(configure_command, cwd = 'fontforge')
os.waitpid(p.pid, 0)[1]
